package com.itchen.hospital.mapper;

import com.itchen.hospital.pojo.Scheduling;
import com.itchen.hospital.pojo.Params;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SchedulingMapper {
    /**
     * 查询所有
     *
     * @return
     */
    List<Scheduling> getAll();

    /**
     * 条件查询
     *
     * @param params
     * @return
     */
    List<Scheduling> findBySearch(@Param("params") Params params);

    /**
     * 添加
     *
     * @param scheduling
     */
    void add(Scheduling scheduling);

    /**
     * 修改
     *
     * @param scheduling
     */
    void update(Scheduling scheduling);

    /**
     * 根据id删除
     *
     * @param id
     */
    @Delete("delete from scheduling where id=#{id}")
    void delete(String id);

    /**
     * 根据名字查询
     *
     * @param departmentName
     * @return
     */
//    @Select("select * from scheduling where DepartmentName = #{departmentName}")
//    Scheduling findByName(String departmentName);

    /**
     * 根据id回显
     *
     * @param id
     * @return
     */
    @Select("select * from scheduling where id = #{id}")
    Scheduling findById(String id);

    /**
     * 根据医生id查询
     * @param id
     */
    @Select("select * from scheduling where doctor_id = #{id} and week = #{todayWeek}")
    Scheduling findByDoctorId(Integer id , String todayWeek);
}
